diff options
| author | Adam Soltys <[email protected]> | 2026-02-15 16:58:17 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-15 16:58:17 -0800 |
| commit | c7e8f628aa215caaa999f06d7fccb910fd5cc099 (patch) | |
| tree | 86af97b298f4d4023b5b00a4c2498b218ecda628 /src/routes/(app)/send/invoice/[id]/+page.server.ts | |
| parent | 5323057a68c1e2607128a3b216a767802725c52c (diff) | |
| download | coinos-ui-c7e8f628aa215caaa999f06d7fccb910fd5cc099.tar.gz coinos-ui-c7e8f628aa215caaa999f06d7fccb910fd5cc099.zip | |
fix custodial bitcoin sends
Diffstat (limited to 'src/routes/(app)/send/invoice/[id]/+page.server.ts')
| -rw-r--r-- | src/routes/(app)/send/invoice/[id]/+page.server.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.ts b/src/routes/(app)/send/invoice/[id]/+page.server.ts index 59add224..dfbe9d26 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.ts +++ b/src/routes/(app)/send/invoice/[id]/+page.server.ts @@ -12,7 +12,7 @@ export async function load({ cookies, depends, params: { id }, parent }) { const trust = await get("/trust", auth(cookies)); const trusted = trust.includes(invoice.uid); - if (trusted && (pin || !user.haspin)) { + if (trusted && (pin || !user.haspin) && invoice.amount) { let p; try { if (!invoice.tip && invoice.user.prompt) { @@ -37,8 +37,12 @@ export async function load({ cookies, depends, params: { id }, parent }) { if (invoice.memoPrompt && invoice.memo === null) redirect(307, `/invoice/${id}/memo`); if (user && invoice.aid === aid) error(500, { message: "Cannot send to self" }); - else if (user && ![types.lightning, types.bolt12].includes(invoice.type)) - redirect(307, `/send/${invoice.type === types.ecash ? "ecash" : "bitcoin"}/${invoice.hash}`); + else if (user && ![types.lightning, types.bolt12].includes(invoice.type)) { + // Don't redirect custodial bitcoin invoices — they should be paid internally + const isVault = invoice.account?.pubkey || invoice.account?.seed; + if (invoice.type !== types.bitcoin || isVault) + redirect(307, `/send/${invoice.type === types.ecash ? "ecash" : "bitcoin"}/${invoice.hash}`); + } if (!user) redirect(307, `/invoice/${id}`); |
